#import "head.h"
#import "sprite_game_object.h"

#define ARROW_STATE_CONTROL 0
#define ARROW_STATE_MOVE 1
#define ARROW_STATE_INVALID 2
#define ARROW_STATE_EXPLODE 3
#define ARROW_STATE_EXPLODE_OVER 4

@interface SpriteGameArrow : SpriteGameObject
{
	/*base
	*/
	int type_;
	int attackPoint_;
	int perforation_;
	int level_;

	/*box2d
	*/
	b2Fixture *fixtureArrow_;
	b2Fixture *fixtureExplode_;

	/*control
	*/
	float defaultRotate_;

	/*movement
	*/
	MOVEMENT_TYPE movementType_;
	TMVParabolaData parabolaData_;
	CGPoint parabolaBasePos_;
	TMVLinearData linearData_;
	int tickCount_;

	/*display
	*/
	CCSprite *image_;
	CCParticleSystem *particle_;

	/*flag
	*/
	int state_;
	bool flagExplode_;
	bool flagExplodeHappened_;
	int tickExplodeFrame_;
}

@property (nonatomic, readwrite) int attackPoint;
@property (nonatomic, readwrite) int perforation;
@property (nonatomic, readwrite) float defaultRotate;
@property (nonatomic, readwrite) MOVEMENT_TYPE movementType;
@property (nonatomic, readwrite) CGPoint parabolaBasePos;
@property (nonatomic, readwrite) int state;
@property (nonatomic, readwrite) bool flagExplode;

- (id)initSpriteGameArrow:(int)Type;
- (void)tick:(ccTime)Time;

/*box2d
*/
- (void)createBody;
- (void)createExplode;

/*streak
*/
- (void)CreateStreak;
- (void)RemoveStreak;

/*game state control
*/
- (void)Pause;
- (void)Resume;

/*get arrow property
*/
- (float)GetMaxDragLength;
- (float)GetLength;
- (float)GetNextLevelHoldTime;
- (CGPoint)GetPreLinePosition;

/*add the level of arrow
*/
- (void)AddLevel;

/*check is max level
*/
- (bool)IsMaxLevel;

/*when check collision, return if is arrow fixture
*/
- (bool)IsMyFixtureArrow:(b2Fixture *)Fixture;
- (bool)IsMyFixtureExplode:(b2Fixture *)Fixture;

/*action
*/
- (void)ActionInvalid;
- (void)ActionExplode;

/*play animation
*/
- (void)PlayAniNormal;
- (void)PlayAniInvalid;
- (void)PlayAniExplode;

/*movement
*/
- (void)StartParabolaMovement:(CGPoint)BasePos And:(CGPoint)Speed;
- (void)StartLinearMovement:(CGPoint)StartPos And:(CGPoint)EndPos And:(float)Speed;
- (void)StopMovement;

/*call back function
*/
- (void)CallBackAniInvalidOver:(id)Sender;
- (void)CallBackAniExplodeOver:(id)Sender;

@end
